package cn.hznc.controller.order;

import cn.hznc.controller.service.order.MaterialService;
import cn.hznc.domain.entity.OrderEntity;
import cn.hznc.domain.request.order.AddOrEditMaterialReq;
import cn.hznc.domain.request.order.QueryOrderReq;
import cn.hznc.domain.response.PageResult;
import cn.hznc.domain.response.ResponseBody;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author：Administrator
 * @Date：2023/6/11 21:11
 */
@RestController
@CrossOrigin(origins = "*", maxAge = 3600)
@RequestMapping("/order")
@Slf4j
public class MaterialController{

    @Autowired
    private MaterialService materialService;

    @RequestMapping(value = "/addOrEditMaterial", method = RequestMethod.POST)
    public ResponseBody addOrEditMaterial(@RequestBody AddOrEditMaterialReq addOrEditMaterialReq) {
        return ResponseBody.success(materialService.addOrEditMaterial(addOrEditMaterialReq));
    }

    @RequestMapping(value = "/deleteMaterial", method = RequestMethod.GET)
    public ResponseBody deleteMaterial(@RequestParam Integer id) {
        return ResponseBody.success(materialService.deleteMaterial(id));
    }

}
